import { _decorator, AnimationClip, Component, Node,Animation, SpriteFrame } from 'cc';
import { FSM_PARAMS_TYPE_ENUM } from '../Enums';
import State from './State';
import { StateMachine } from './StateMachine';

const { ccclass, property } = _decorator;

//不是组件可以去掉
//@ccclass('SubStateMachine')
export abstract class SubStateMachine {

  // 核心属性
  private _currentState: State = null               // 当前状态
  //子状态机的参数列表也是父状态机的参数列表
  // params: Map<string, IParamsValue> = new Map()     // 参数列表
  stateMachines: Map<string, State> = new Map()     // 状态机列表

  constructor(public fsm:StateMachine){

  }

  get currentState(){
    return this._currentState
  }

  set currentState(newState:State){
    this._currentState=newState
    this._currentState.run()
  }

  abstract run():void
}


